From a639ca4291009cdebb3f997829724abbe11e3e16 Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 3 Jun 2003 18:14:29 +0000 Subject: [PATCH] Make rtrim work sensibly when passed null pointers or pointers to empty strings. --- gpsbabel/util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gpsbabel/util.c b/gpsbabel/util.c index 52cfb4c19..06656b4e0 100644 --- a/gpsbabel/util.c +++ b/gpsbabel/util.c @@ -194,6 +194,10 @@ pstrdup(char *src) void rtrim(char *s) { + if (!s || !*s) { + return; + } + while (*s) { s++; } -- 2.30.2